<?php
use yii\widgets\ActiveForm;
use common\components\helpers\Fun;
?>
<style>
    select{width:200px!important;}
</style>
 <div class="yx-praise-list-box yx-praise-box yx-radius2 zx-min-height" >
    <?php $form = ActiveForm::begin(['enableAjaxValidation' => true, 'enableClientValidation' => true,'options'=>['class'=>'form-validate']]); ?>
    <table width="100%" class="table-form">
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['cat_id']; ?></th>
            <td><?= $form->field($model, 'cat_id', ['template' => '{input}{error}{hint}'])->dropDownList($tree, ['prompt' => '请选择分类', 'style' => 'width:210px','encode'=>false]) ?></td>
        </tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['name']; ?></th>
            <td><?= $form->field($model, 'name', ['template' => '{input}{error}{hint}'])->textInput(['class' => 'input-text','readonly'=>$is_update]) ?></td>
        </tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['brand_id']; ?></th>
            <td><?= $form->field($model, 'brand_id', ['template' => '{input}{error}{hint}'])->dropDownList($brand, ['prompt' => '商品品牌', 'style' => 'width:210px']) ?></td>
        </tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['price']; ?></th>
            <td><?= $form->field($model, 'price', ['template' => '{input}{error}{hint}'])->textInput([ 'class' => 'input-text']) ?></td>
        </tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['cost']; ?></th>
            <td><?= $form->field($model, 'cost', ['template' => '{input}{error}{hint}'])->textInput([ 'class' => 'input-text']); ?></td>
        </tr>
        <tr>
            <th  class="zx-goods-table"><?= $model->attributeLabels()['market_price']; ?></th>
            <td><?= $form->field($model, 'market_price', ['template' => '{input}{error}{hint}'])->textInput(['class' => 'input-text']); ?></td>
        </tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['store']; ?></th>
            <td><?= $form->field($model, 'store', ['template' => '{input}{error}{hint}'])->textInput(['class' => 'input-text']); ?></td>
        </tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['picture']; ?></th>
            <td><?php if($type_id == 1){?>
                <?= $form->field($model, 'picture', ['template' => '{input}{error}{hint}'])->widget(\doumiaoduo\ueditor\ImageUploadSingle::className(),['options'=>[
                    'class'=>'input-text',
                ],
                    'clientOptions'=>[
                        'serverUrl'=>\common\components\helpers\Fun::url(['/uploader/action'])
                    ],
                    'buttonOptions'=>[
                        'class'=>'button'
                    ]]); ?>
            <?php }else{?>
                    <?= $form->field($model, 'imageList', ['template' => '{input}{error}{hint}'])->widget(\doumiaoduo\ueditor\ImageUploadMultiple::className(),['options'=>[
                        'class'=>'input-text',
                    ],
                        'clientOptions'=>[
                            'serverUrl'=>\common\components\helpers\Fun::url(['/uploader/action'])
                        ],]); ?>
            <?php }?></td>
        </tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['description']; ?></th>
            <td><?= $form->field($model, 'description', ['template' => '{input}{error}{hint}'])->widget(\doumiaoduo\ueditor\Ueditor::className(), ['clientOptions'=>[
                    'serverUrl'=>\common\components\helpers\Fun::url(['/uploader/action']),
                    'toolbars'=>[['fullscreen', 'source', '|', 'undo', 'redo', '|','bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript','rowspacingtop', 'rowspacingbottom', 'lineheight', '|','justifyleft', 'justifycenter', 'justifyright', 'justifyjustify','simpleupload']],
                    'initialFrameWidth'=>'100%'
                ]]); ?></td>
        </tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['content']; ?></th>
            <td><?= $form->field($model, 'content', ['template' => '{input}{error}{hint}'])->widget(\doumiaoduo\ueditor\Ueditor::className(), ['clientOptions'=>[
                    'serverUrl'=>\common\components\helpers\Fun::url(['/uploader/action']),
                    'toolbars'=>[['fullscreen', 'source', '|', 'undo', 'redo', '|','bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript','rowspacingtop', 'rowspacingbottom', 'lineheight', '|','justifyleft', 'justifycenter', 'justifyright', 'justifyjustify','simpleupload']],
                    'initialFrameWidth'=>'100%'
                ]]); ?></td>
        </tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['mechanic_id']; ?></th>
            <td><?= $form->field($model, 'mechanic_id', ['template' => '{input}{error}{hint}'])->dropDownList($mechanic, ['prompt' => '机构名称', 'style' => 'width:210px','encode'=>false]) ?></td>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['max_buy']; ?></th>
            <td><?= $form->field($model, 'max_buy', ['template' => '{input}{error}{hint}'])->textInput(['class' => 'input-text']); ?></td>
        </tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['score']; ?></th>
            <td><?= $form->field($model, 'score', ['template' => '{input}{error}{hint}'])->textInput(['class' => 'input-text']); ?></td>
        </tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['store_prompt']; ?></th>
            <td><?= $form->field($model, 'store_prompt', ['template' => '{input}{error}{hint}'])->textInput(['class' => 'input-text']); ?></td>
        </tr>
        <tr style="display: none">
            <th class="zx-goods-table"><?= $model->attributeLabels()['arrangement_id']; ?></th>
            <td><?= $form->field($model, 'arrangement_id', ['template' => '{input}{error}{hint}'])->hiddenInput(); ?></td>
        </tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['nostore_sell']; ?></th>
            <td><?= $form->field($model, 'nostore_sell', ['template' => '{input}{error}{hint}'])->radioList(['N'=>'否','Y'=>'是'],['class' => 'radiolist']); ?></td>
        </tr>
        <tr>
            <th  class="zx-goods-table"><?= $model->attributeLabels()['is_buy']; ?></th>
            <td><?= $form->field($model, 'is_buy', ['template' => '{input}{error}{hint}'])->radioList(['0'=>'否','1'=>'是'],[ 'class' => 'radiolist']); ?></td>
        </tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['is_show']; ?></th>
            <td><?= $form->field($model, 'is_show', ['template' => '{input}{error}{hint}'])->radioList(['0'=>'否','1'=>'是'],['class' => 'radiolist']); ?></td>
        </tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['is_shelve']; ?></th>
            <td><?= $form->field($model, 'is_shelve', ['template' => '{input}{error}{hint}'])->radioList(['0'=>'下架','1'=>'上架'],['class' => 'radiolist']); ?></td>
        </tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['suitable_age']; ?></th>
            <td>
                <table>
                    <tr>
                        <?php
                        $ages = range(3,18);
                        $arr = [];
                        foreach($ages as $v){
                            $arr[$v] = $v.'岁';
                        }
                        ?>
                        <td style="border-bottom: 0"><?= $form->field($model, 'min_age', ['template' => '{input}{error}{hint}'])->dropDownList($arr,['prompt' => '最小年龄', 'style' => 'width:100px']) ?></td>
                        <td style="border-bottom: 0"><?= $form->field($model, 'max_age', ['template' => '{input}{error}{hint}'])->dropDownList($arr,['prompt' => '最大年龄', 'style' => 'width:100px']) ?></td>
                    </tr>
                </table>
            </td>
        <tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['region']; ?></th>
            <td><?= $form->field($model, 'region', ['template' => '{input}{error}{hint}'])->dropDownList(Fun::getArea(Fun::getSiteId()),['prompt'=>'请选择···', 'style' => 'width:210px']); ?></td>
        </tr>
        <?=$attribute?>
    </table>
</div>


